package Test.Bean;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 使用@ConfigurationProperties注解需要显式setter和getter，同时声明是一个配置类的组件
 * 使用@Component注解来放进IOC容器中，不需要在MyConfig中放入容器
 */
@Component
@ConfigurationProperties(prefix = "redis")
public class RedisCusConfigBean {
    private String url;
    private String port;

    public String getPort() {
        return port;
    }

    public void setPort(String port) {
        this.port = port;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String toString(){
        return  this.url + " : " + this.port;
    }
}
